package com.lhd.action.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: liuhd
 * @Date: 2024/12/19 15:27
 * @Description: 对象结构类
 */
public class GoodsCart {
    private List<Product> list = new ArrayList<>();
    private Visitor visitor;

    public void setVisitor(Visitor visitor) {
        this.visitor = visitor;
    }
    public void accept(){
        for (Product product : list) {
            product.accept(visitor);
        }
    }
    public void addProduct(Product product){
        list.add(product);
    }

}
